Imports System.Xml.Serialization
Namespace SSDL

    Public Class EntityContainer
        Inherits XEntityModelElementWithDocumentationBase

        ''' <summary>Initializes an instance of the <see cref="EntityContainer" /> class.
        ''' This is the default constructor for this class.</summary>
        Public Sub New()
            MyBase.New("EntityContainer", SsdlXmlNamespace)
        End Sub

        ''' <summary>Initializes an instance of the <see cref="EntityContainer" /> class.</summary>
        ''' <param name="other">An <see cref="System.Xml.Linq.XElement"/> object to copy from.</param>
        Public Sub New(ByVal other As XElement)
            MyBase.New(other)
        End Sub

        Private __EntitySets As EntityContainerEntitySetCollection
        Private __AssociationSets As EntityContainerAssociationSetCollection

        <AutoLoad()> _
        <XmlElement("EntitySet", GetType(EntityContainerEntitySet))> _
        Public ReadOnly Property EntitySets() As EntityContainerEntitySetCollection
            Get
                If (__EntitySets Is Nothing) Then
                    __EntitySets = New EdmxEditor.SSDL.EntityContainerEntitySetCollection(Me, MyBase.Name.Namespace, "EntitySet")
                End If
                Return __EntitySets
            End Get
        End Property

        Public ReadOnly Property EntitySet(ByVal name As String)
            Get
                Return __EntitySets.Where(Function(x) x.Name = name).FirstOrDefault()
            End Get
        End Property

        <AutoLoad()> _
        <XmlElement("AssociationSet", GetType(EntityContainerAssociationSet))> _
        Public ReadOnly Property AssociationSets() As EntityContainerAssociationSetCollection
            Get
                If (__AssociationSets Is Nothing) Then
                    __AssociationSets = New EdmxEditor.SSDL.EntityContainerAssociationSetCollection(Me, MyBase.Name.Namespace, "AssociationSet")
                End If
                Return __AssociationSets
            End Get
        End Property

        <XmlAttribute()> _
        Public Shadows Property Name() As String
            Get
                Return Me.@Name
            End Get
            Set(ByVal value As String)
                Me.@Name = value
            End Set
        End Property

    End Class

End Namespace
